package com.jsptags.navigation.pager;

import com.jsptags.navigation.pager.parser.IndexTagExport;
import com.jsptags.navigation.pager.parser.ParseException;
import com.jsptags.navigation.pager.parser.TagExportParser;
import javax.servlet.jsp.tagext.*;

public final class IndexTagExtraInfo extends TagExtraInfo {

	static Class<Integer> clazz; /* synthetic field */

	@SuppressWarnings("unchecked")
	public final VariableInfo[] getVariableInfo(TagData tagdata) {
		try {
			String s;
			s = tagdata.getAttributeString("export");
			if (s == null)
				return null;
			VariableInfo avariableinfo[];
			IndexTagExport indextagexport = TagExportParser
					.parseIndexTagExport(s);
			int i = 0;
			if (indextagexport.getItemCount() != null)
				i++;
			if (indextagexport.getPageCount() != null)
				i++;
			avariableinfo = new VariableInfo[i];
			int j = 0;
			String s1;
			if ((s1 = indextagexport.getItemCount()) != null)
				avariableinfo[j++] = new VariableInfo(
						s1,
						(clazz == null
								&& (clazz = class$("[java.lang.Integer", false)) == null ? clazz
								: clazz).getName(), true, 0);
			if ((s1 = indextagexport.getPageCount()) != null)
				avariableinfo[j++] = new VariableInfo(
						s1,
						(clazz == null
								&& (clazz = class$("[java.lang.Integer", false)) == null ? clazz
								: clazz).getName(), true, 0);
			return avariableinfo;
		} catch (ParseException e) {
			return new VariableInfo[0];
		}
	}

	public final boolean isValid(TagData tagdata) {
		String s = tagdata.getAttributeString("export");
		if (s != null)
			try {
				TagExportParser.parseIndexTagExport(s);
			} catch (ParseException parseexception) {
				return false;
			}
		return true;
	}

	@SuppressWarnings("unchecked")
	static Class class$(String s, boolean flag) {
		try {
			Class claz = Class.forName(s);
			if (flag) {
				return null;
			} else {
				return claz;
			}
		} catch (ClassNotFoundException e) {
			throw new NoClassDefFoundError(e.getMessage());
		}
	}

}
